
import java.util.Scanner;

class LUA_BETA {
    
    static Scanner entrada = new Scanner(System.in);

    static int N, M, X, Y, n = 1;
    static int[] vet;
    static int[] media;

    public static void main(String[] args) {

        while ((N = entrada.nextInt()) != 0 & (M = entrada.nextInt()) != 0) {

            vet = new int[N];
            media = new int[N - (M - 1)];

            for (int x = 0; x < N; x++) {
                vet[x] = entrada.nextInt();
            }
            for (int i = 0; i < media.length; i++) {
                int soma = 0;
                for (int j = i; j < (i + M); j++) {
                    soma += vet[j];
                }
                media[i] = soma / M;
            }

            X = Y = media[0];
            for (int i = 0; i < media.length; i++) {
                if (X > media[i]) {
                    X = media[i];
                }
                if (Y < media[i]) {
                    Y = media[i];
                }
            }
            System.out.println("Teste " + n++);
            System.out.print(X + " " + Y);
            System.out.println();
            System.out.println();
        }
    }
}
